package com.eastfair.pay.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * RefundQueryBody
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RefundQueryBody {
    //消息ID
    String msgId;
    //报文请求时间，格式yyyy-MM-ddHH:mm:ss
    String requestTimestamp;
    //请求系统预留字段
    String srcReserve;
    //商户号
    String mid;
    //终端号
    String tid;
    //业务类型
    String instMid;
    //商户订单号
    String merOrderId;

    String toJson() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (this.msgId != null) {
            sb.append("\"msgId\":\"" + this.msgId + "\",");
        }
        if (this.requestTimestamp != null) {
            sb.append("\"requestTimestamp\":\"" + this.requestTimestamp + "\",");
        }
        if (this.srcReserve != null) {
            sb.append("\"srcReserve\":\"" + this.srcReserve + "\",");
        }
        if (this.mid != null) {
            sb.append("\"mid\":\"" + this.mid + "\",");
        }
        if (this.tid != null) {
            sb.append("\"tid\":\"" + this.tid + "\",");
        }
        if (this.instMid != null) {
            sb.append("\"instMid\":\"" + this.instMid + "\",");
        }
        if (this.merOrderId != null) {
            sb.append("\"merOrderId\":\"" + this.merOrderId + "\",");
        }
        if (sb.charAt(sb.length() - 1) == ',') {
            sb.deleteCharAt(sb.length() - 1);
        }
        sb.append("}");
        return sb.toString();
    }

    @Override
    public String toString() {
        return this.toJson();
    }

}